package student.stu23002142.chapter09;
class Person3{
    private String name;
    private int age;

    public Person3() {
    }

    public Person3(String name, int age){			//定义有参构造方法
        this.setName(name);
        this.setAge(age);
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public String toString() {
        return "姓名："+this.name+",年龄："+this.age;
    }
}

public class Demo03 {public static void main(String args[]){
    Class<?> c = null;
    try{
        c = Class.forName("student.stu23002142.chapter09.Person3");
    }catch(ClassNotFoundException e){
        e.printStackTrace();
    }
    Person3 per = null;
    try{
        per = (Person3)c.newInstance();
    }catch (Exception e){
        e.printStackTrace();
    }
}

}
